#include<iostream>
#include<vector>
using namespace std;
class Solution {
public:
    int pivotIndex(vector<int>& nums) {
        int len = nums.size() - 1;
        vector<int> f(len + 1, 0);
        vector<int> g(len + 1, 0);
        for (int i = 1; i <= len; i++) {
            f[i] = f[i - 1] + nums[i - 1];
        }
        for (int i = len - 1; i >= 0; i--) {
            g[i] = g[i + 1] + nums[i + 1];
        }
        for (int i = 0; i <= len; i++) {
            if (f[i] == g[i]) {
                return i;
            }
        }
        return -1;
    }
};
int main() {
    return 0;
}